/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yunhoo.pay.bean;

import com.ibatis.dao.client.DaoManager;
import com.yunhoo.asset.util.PayCodeConstants;
import com.yunhoo.base.bean.FinancialProjectBean;
import com.yunhoo.base.db.dao.FinancialProjectDao;
import com.yunhoo.base.db.dao.PersonDao;
import com.yunhoo.base.db.impl.BusinessParameterImpl;
import com.yunhoo.pay.db.impl.AbroadGroupImpl;
import com.yunhoo.base.model.ClassCode;
import com.yunhoo.base.model.Department;
import com.yunhoo.base.model.FinancialProject;
import com.yunhoo.base.model.PayStyle;
import com.yunhoo.base.model.Person;
import com.yunhoo.pay.db.impl.CostProofImpl;
import com.yunhoo.pay.db.impl.VoucherPubImpl;
import com.yunhoo.pay.model.Expense;
import com.yunhoo.pay.model.QueryVouchers;
import com.yunhoo.pay.model.VouCheckInfo;
import com.yunhoo.sys.db.config.DaoConfig;
import com.yunhoo.pay.util.BillQueryToolKit;
import com.yunhoo.sys.util.common.LoginParam;
import com.yunhoo.sys.util.common.MoneyUtil;
import com.yunhoo.sys.util.common.NavigationTool;
import com.yunhoo.sys.util.common.Null;
import com.yunhoo.sys.util.common.PrintToolKit;
import com.yunhoo.sys.util.common.ToolKit;
import com.yunhoo.pay.util.ToolsMethed;
import com.yunhoo.sys.login.LoginBean;
import com.yunhoo.sys.util.tree.TreeUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFooter;
import org.apache.poi.hssf.usermodel.HSSFHeader;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.richfaces.component.UIDataTable;
import org.richfaces.event.TreeSelectionChangeEvent;

/**
 *
 * @author Administrator
 */
@ManagedBean(name = "proof")
@SessionScoped
public class CostProofBean {

    private Expense exp = new Expense();
    private LinkedList<Expense> proofList = new LinkedList<Expense>();//浏览时单据容器
    private List<SelectItem> payStylelist = null;//支付方式列表 
    private QueryVouchers qlb = new QueryVouchers();//单据列表查询页面对象
    private List<Expense> billList = new ArrayList<Expense>();
    private DataModel billModel = new ListDataModel();
    private int vouIndex = -1;
    private UIDataTable personData = null;
    private boolean addOrUpdate;//编辑时，新增或修改
    private boolean showDisabled = true;//前后浏览状态
    private boolean submitOrNot = true;//提交状态
    private boolean editStatus = false;//编辑状态下，只能保存或放弃
    private boolean updateAble = true;
    private List<SelectItem> feeItems = null;
    private String payWay;
    private static DaoManager daom;
    private static FinancialProjectDao finProjdao;
    private FinancialProject finProj = null;
    private DataModel<FinancialProject> finProjModel = null;
    private String projParam = "";
    private List<SelectItem> perli = null;
    private static PersonDao perDao;

    public CostProofBean() {
        daom = DaoConfig.getDaoManager();
        finProjdao = (FinancialProjectDao) daom.getDao(FinancialProjectDao.class);
        perDao = (PersonDao) daom.getDao(PersonDao.class);
        initStatus();
        initFeeItems();
        initPayStyleList();
        //proofQuery();
        initFinProjList();//预算项目列表
    }

    public final void initStatus() {
        addOrUpdate = false;
        submitOrNot = true;
        showDisabled = true;
        editStatus = false;
        updateAble = true;
        initVoucherList();
    }

    public final void initVoucherList() {
        proofList = new LinkedList<Expense>();
        Map map = new HashMap();
        map.put("cpsn_number", curPerNum().trim());
        map.put("orgCode", curOrgCode().trim());
        List<Expense> source = CostProofImpl.proofListByPerson(map);
        proofList.addAll(source);
    }

    public final void initFeeItems() {
        List<ClassCode> items = CostProofImpl.feeItems();
        feeItems = new ArrayList<SelectItem>();
        for (ClassCode valueItem : items) {
            feeItems.add(new SelectItem(valueItem.getCode().trim(), valueItem.getName().trim()));
        }
    }
    //选择部门

    public void selected(TreeSelectionChangeEvent event) {
        Department dp = (Department) TreeUtil.listener(event);
        exp.getPayDept().setCode(dp.getCode());
        exp.getPayDept().setName(dp.getName());
        if (!Null.check(exp.getPayDept().getCode())) {
            queryPerLi();
        }
    }

    private void queryPerLi() {
        perli = new ArrayList<SelectItem>();
        List<Person> templi = null;
        try {
            Person param = new Person();
            param.setOrgCode(curOrgCode());
            param.setIyear(curIyear());
            param.setDeptCode(exp.getPayDept().getCode());
            templi = perDao.queryListByDept(param);
        } catch (SQLException ex) {
            Logger.getLogger(LoginBean.class.getName()).log(Level.SEVERE, null, ex);
        }
        if (templi != null) {
            for (Person p : templi) {
                perli.add(new SelectItem(p.getCpsn_number().trim(), p.getCpsn_name().trim()));
            }
        }
    }

    private void initFinProjList() {
        if (finProjModel == null) {
            finProjModel = new ListDataModel<FinancialProject>();
        }
        try {
            List<FinancialProject> finli = finProjdao.queryAll(new FinancialProject(true));
            finProjModel.setWrappedData(finli);
        } catch (SQLException ex) {
            Logger.getLogger(FinancialProjectBean.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    //选择预算项目

    public void projSelected() {
        finProj = finProjModel.getRowData();
        exp.getProject().setFinCode(finProj.getFinCode());
        exp.getProject().setFinName(finProj.getFinName());
        exp.getProject().setCostType(finProj.getCostType());
    }

    public final void initPayStyleList() {
        payStylelist = new ArrayList();
        List<PayStyle> Styleli = AbroadGroupImpl.getPaystyleliNew("5");
        for (PayStyle d : Styleli) {
            payStylelist.add(new SelectItem(d.getCode(), d.getName()));
        }
    }

    //保存检查
    public void checkandRep() {
        projParam = "1";
        String paramValue = BusinessParameterImpl.queryParamValue(projParam.trim());//1、必填 0、可不必须填写
        if (Null.check(exp.getAffair())) {
            ToolKit.msgs_err("您还没有输入报销内容!");
            FacesContext.getCurrentInstance().renderResponse();
        } else if (exp.getTotal() == null || exp.getTotal() == 0d) {
            ToolKit.msgs_err("报销费用0元?");
            FacesContext.getCurrentInstance().renderResponse();
        } else if (Null.check(exp.getProject().getFinCode()) && paramValue.equals("1")) {
            ToolKit.msgs_err("请选择预算项目!");
            FacesContext.getCurrentInstance().renderResponse();
        } else if (Null.check(exp.getFeePer().getCpsn_number())) {
            ToolKit.msgs_err("请选择经手人员!");
        } else if (exp.getNumDate() == null) {
            ToolKit.msgs_err("日期不能为空!");
        } else if (Null.check(exp.getFeeItem().getCode())) {
            ToolKit.msgs_err("请费用项目不能为空!");
        } else if (Null.check(exp.getPayStyle().getCode())) {
            ToolKit.msgs_err("请选择支付方式!");
        } else if (Null.check(exp.getAffixAmount())) {
            ToolKit.msgs_err("请填写附件张数!");
        } else {
            save();
            ToolKit.msgs_info("请点击【提交】按钮提交单据并打印本单据!");
        }
    }

    public void save() {
        if (addOrUpdate) {
            exp.setVoutype("5");
            //exp.setNumber(ToolsMethed.getCostProofNumber());
            exp.getUser().setCpsn_number(curPerNum().trim());
            exp.getDept().setCode(curDeptCode().trim());
            exp.setRemain(exp.getTotal() - Null.convert(exp.getTaxAmount()));

//            Map map = new HashMap();
//            map.put("number", exp.getNumber());
//            map.put("item", exp.getFeeItem().getCode().trim());
//            map.put("amount", exp.getTotal());
//            map.put("orgCode", curOrgCode().trim());
//            CostProofImpl.insertFeeDetail(map);
//            CostProofImpl.insertCostProof(exp);
            CostProofImpl.insert(exp);
        }
        if (!addOrUpdate) {
            exp.setNumberStatus("1");
            exp.setRemain(exp.getTotal() - Null.convert(exp.getTaxAmount()));

//            Map map = new HashMap();
//            map.put("number", exp.getNumber());
//            map.put("feeItem", exp.getFeeItem().getCode().trim());
//            map.put("amount", exp.getTotal());
//            map.put("orgCode", curOrgCode().trim());
//            CostProofImpl.updateCostProofByPerson(exp);
//            CostProofImpl.updateFeeDetail(map);

            CostProofImpl.update(exp);
        }
        addOrUpdate = false;
        submitOrNot = false;
        showDisabled = false;
        editStatus = false;
        updateAble = false;
        initVoucherList();
    }

    public void cancel() {
        exp = new Expense();
        initStatus();
        FacesContext.getCurrentInstance().renderResponse();
    }

    //动态查询 取消
    public void queryCancel() {
        qlb = new QueryVouchers();
        Map map = new HashMap();
        map.put("cpsn_number", curPerNum().trim());
        billList = CostProofImpl.proofResultList(map);
    }

    public void add() {
        exp = new Expense();
        //exp.setNumber(ToolsMethed.getCostProofNumber());
        exp.getUser().setCpsn_name(curPerName().trim());
        exp.getDept().setName(curDeptName().trim());
        exp.setNumDate(curLoginDate());
        exp.getPayDept().setCode(curDeptCode().trim());
        exp.getPayDept().setName(curDeptName().trim());
        exp.getFeePer().setCpsn_number(curPerNum().trim());
        queryPerLi();

        addOrUpdate = true;
        editStatus = true;
        showDisabled = true;

        FacesContext.getCurrentInstance().renderResponse();
    }

    public void update() {
        if (!Null.check(exp.getNumber())) {
            addOrUpdate = false;
            submitOrNot = false;
            showDisabled = true;
            editStatus = true;
            vouIndex = proofList.indexOf(exp);
        } else {
            ToolKit.msgs_info("没有单据");
        }
    }

    public void delete() {
        CostProofImpl.delProofByNumber(exp.getNumber().trim());
        CostProofImpl.delProofFeeDetailByNumber(exp.getNumber().trim());
        initStatus();
        initVoucherList();
        this.setExp(new Expense());
    }

    public void submitBill() {
        Map map = new HashMap();
        map.put("number", exp.getNumber().trim());
        map.put("voutype", exp.getVoutype().trim());
        map.put("orgCode", curOrgCode().trim());
        CostProofImpl.submitProof(map);
        //删除历史审核信息
        VouCheckInfo info = new VouCheckInfo();
        info.setBillNum(exp.getNumber());
        info.setVouType(exp.getVoutype());
        VoucherPubImpl.deleteCheckInfo(info);

        exp.setNumberStatus("0");
        initStatus();
        ToolKit.msgs_info("单据已提交成功，等待审核!");
    }

    public void getFirst() {
        if (proofList.size() > 0) {
            exp = proofList.getFirst();
            queryPerLi();
            if (exp.getTaxAmount() == 0) exp.setTaxAmount(null);
            this.showDisabled = false;
            defailt();
        } else {
            ToolKit.msgs_info("您尚未录入单据!");
        }
        FacesContext.getCurrentInstance().renderResponse();
    }

    public void previouse() {
        int index = proofList.indexOf(exp);
        //System.out.println("Index:" + index);
        if (index > 0) {
            exp = proofList.get(index - 1);
            queryPerLi();
            if (exp.getTaxAmount() == 0) exp.setTaxAmount(null);
            this.showDisabled = false;
            defailt();
        } else {
            ToolKit.msgs_info("没有了!");
        }
        FacesContext.getCurrentInstance().renderResponse();
    }

    public void next() {
        int index = proofList.indexOf(exp);
        //System.out.println("Index:" + index);
        if (index < proofList.size() - 1) {
            exp = proofList.get(index + 1);
            queryPerLi();
            if (exp.getTaxAmount() == 0) exp.setTaxAmount(null);
            this.showDisabled = false;
            defailt();
        } else {
            ToolKit.msgs_info("没有了!");
        }
        FacesContext.getCurrentInstance().renderResponse();
    }

    public void getLast() {
        if (proofList.size() > 0) {
            exp = proofList.getLast();
            queryPerLi();
            if (exp.getTaxAmount() == 0) exp.setTaxAmount(null);
            this.showDisabled = false;
            defailt();
        } else {
            ToolKit.msgs_info("您尚未录入单据!");
        }
        FacesContext.getCurrentInstance().renderResponse();
    }

    public void defailt() {
        if ("1".equals(exp.getNumberStatus().trim())) {
            submitOrNot = false;
        } else {
            submitOrNot = true;
        }
    }

    public void process(OutputStream outStream, Object data) throws Exception {
        printBill();
    }

    public void printBill() {
        try {
            PrintToolKit.print(reportParameter(), "/page/pay/print/costproof.jasper");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private Map reportParameter() {
        Map map = new HashMap();
        for (SelectItem item : feeItems) {
            if (item.getValue().toString().equals(exp.getFeeItem().getCode())) {
                exp.getFeeItem().setName(item.getLabel());
                break;
            }
        }
        map.put("numDate", exp.getNumDate());
        map.put("number", exp.getNumber());
        map.put("costType", exp.getCostType());
        map.put("deptname", exp.getDept().getName());
        map.put("projName", exp.getProject().getFinName());
        map.put("affair", exp.getAffair());
        map.put("feeItem", exp.getFeeItem().getName());
        map.put("total", exp.getTotal());
        map.put("affixAmount", exp.getAffixAmount());
        map.put("taxAmount", Null.convert(exp.getTaxAmount()));
        map.put("money", MoneyUtil.toChinese(String.valueOf(Null.convert(exp.getTotal() == null ? 0d : exp.getTotal()))));
        map.put("moneyC", Null.convert(exp.getTotal()) - Null.convert(exp.getTaxAmount()));
        map.put("cpsn_name", exp.getUser().getCpsn_name());
        map.put("isBaseCost", isBaseCost());//是基本支出
        System.out.println("isBaseCost : " + isBaseCost());
        System.out.println("proj costType : " + exp.getProject().getCostType());
        return map;
    }

    private String isBaseCost() {
        if (exp.getProject() == null || Null.check(exp.getProject().getFinCode())) return "";
        else if (exp.getProject().getCostType() == 1) return "0";
        else if (exp.getProject().getCostType() == 0) return "1";
        else return "";
    }

    public void rescind() {
        Map map = new HashMap();
        map.put("orgCode", curOrgCode().trim());
        map.put("number", exp.getNumber().trim());
        map.put("voutype", exp.getVoutype().trim());
        CostProofImpl.rescindVoucher(map);
        exp.setNumberStatus("1");
        initStatus();
        submitOrNot = false;
    }
    //选择预算项目

    public void selectProjForQuery() {
        FinancialProject fProj = finProjModel.getRowData();
        qlb.getProject().setFinCode(fProj.getFinCode());
        qlb.getProject().setFinName(fProj.getFinName());
    }
    //单据列表查询

    public void proofQuery() {
        Map map = BillQueryToolKit.billQueryParamMap(qlb);
        map.put("cpsn_number", curPerNum().trim());
        map.put("orgCode", curOrgCode().trim());
        billList = CostProofImpl.proofResultList(map);
        billModel.setWrappedData(billList);
    }

    public void showBill() {
        exp = (Expense) billModel.getRowData();
        queryPerLi();
        if (exp.getTaxAmount() == 0) exp.setTaxAmount(null);
        if (exp.getNumberStatus().trim().equalsIgnoreCase("0")) {
            exp.setCheckaccount(exp.getTotal());
        }
        exp.setAuditDate(curLoginDate());
        submitOrNot = false;
        showDisabled = false;
        editStatus = false;
        addOrUpdate = false;

        NavigationTool.getSelectedUrl("/page/pay/business/person/costProof.xhtml");
    }

    public void clearQueryResult(ActionEvent e) {
        billModel.setWrappedData(new ArrayList<Expense>());
    }

    public void exportExcel() {
        HSSFWorkbook demoWorkBook = new HSSFWorkbook();
        HSSFSheet demoSheet = demoWorkBook.createSheet("个人单据支出证明单列表");
        String[] excelColumns = initTabeleHeader();
        List<Expense> rows = billList;

        HSSFHeader header = demoSheet.getHeader();
        header.setCenter("个人单据支出证明单列表");
        HSSFRow headerRow = demoSheet.createRow(0);
        for (int i = 0; i < excelColumns.length; i++) {
            HSSFCell headerCell = headerRow.createCell((short) i);
            //headerCell.setEncoding(HSSFCell.ENCODING_UTF_16);
            headerCell.setCellValue(excelColumns[i]);
        }
        //填充数据
        int rowIndex = 1;
        for (Expense row : rows) {
            createTableRow(demoWorkBook, demoSheet, row, rowIndex);
            rowIndex++;
        }
        exportExcel(demoWorkBook, demoSheet);

    }

    //初始化表头信息
    public String[] initTabeleHeader() {
        String[] excelColumns = {"单据编号", "单据状态", "单据日期", "报销内容", "报销金额", "预算项目", "经手人员", "部门", "支出类别", "预算来源", "经济分类", "支出渠道",
            "支付令", "核定金额", "还款金额", "待支付金额", "审核日期", "审核人", "支付金额", "支付日期", "出纳"};
        return excelColumns;
    }

    public static void createTableRow(HSSFWorkbook demoWorkBook, HSSFSheet demoSheet, Expense eit, int rowIndex) {
        //创建第rowIndex行
        CreationHelper createHelper = demoWorkBook.getCreationHelper();
        HSSFCellStyle dstyle = demoWorkBook.createCellStyle();
        dstyle.setDataFormat(createHelper.createDataFormat().getFormat("yyyy-mm-dd"));//格式

        HSSFCell cell = null;
        HSSFRow row = demoSheet.createRow(rowIndex);

        cell = row.createCell(0);
        cell.setCellValue(PayCodeConstants.convertString(eit.getNumber()));
        cell = row.createCell(1);
        cell.setCellValue(PayCodeConstants.convertString(PayCodeConstants.functionNumberStatus().get(eit.getNumberStatus())));
        cell = row.createCell(2);
        cell.setCellValue(PayCodeConstants.convertDate(eit.getNumDate()));
        cell.setCellStyle(dstyle);
        cell = row.createCell(3);
        cell.setCellValue(PayCodeConstants.convertString(eit.getAffair()));
        cell = row.createCell(4);
        cell.setCellValue(PayCodeConstants.convertDouble(eit.getTotal()));
        cell = row.createCell(5);
        cell.setCellValue(PayCodeConstants.convertString(eit.getProject().getFinName()));
        cell = row.createCell(6);
        cell.setCellValue(PayCodeConstants.convertString(eit.getUser().getCpsn_name()));
        cell = row.createCell(7);
        cell.setCellValue(PayCodeConstants.convertString(eit.getDept().getName()));
        cell = row.createCell(8);
        cell.setCellValue(PayCodeConstants.convertString(eit.getCostClass()));
        cell = row.createCell(9);
        cell.setCellValue(PayCodeConstants.convertString(eit.getBudgetSource()));
        cell = row.createCell(10);
        cell.setCellValue(PayCodeConstants.convertString(eit.getCostitem().getName()));
        cell = row.createCell(11);
        cell.setCellValue(PayCodeConstants.convertString(eit.getCostTypes().getName()));
        cell = row.createCell(12);
        cell.setCellValue(PayCodeConstants.convertString(eit.getPaycode()));
        cell = row.createCell(13);
        cell.setCellValue(PayCodeConstants.convertDouble(eit.getCheckaccount()));
        cell = row.createCell(14);
        cell.setCellValue(PayCodeConstants.convertDouble(eit.getRepayment()));
        cell = row.createCell(15);
        cell.setCellValue(PayCodeConstants.convertDouble(eit.getRemain()));
        cell = row.createCell(16);
        if (eit.getAuditDate() == null) {
            cell.setCellValue("");
        } else {
            cell.setCellValue(PayCodeConstants.convertDate(eit.getAuditDate()));
            cell.setCellStyle(dstyle);
        }
        cell = row.createCell(17);
        cell.setCellValue(PayCodeConstants.convertString(eit.getAuditor()));
        cell = row.createCell(18);
        cell.setCellValue(PayCodeConstants.convertDouble(eit.getPayaccount()));
        cell = row.createCell(19);
        if (eit.getPayDate() == null) {
            cell.setCellValue("");
        } else {
            cell.setCellValue(PayCodeConstants.convertDate(eit.getPayDate()));
            cell.setCellStyle(dstyle);
        }
        cell = row.createCell(20);
        cell.setCellValue(PayCodeConstants.convertString(eit.getPayer()));

    }

    public static void exportExcel(HSSFWorkbook demoWorkBook, HSSFSheet demoSheet) {
        try {
            String strfileName = "book.xls";
            FileOutputStream fos = null;
            //导出
            demoSheet.setGridsPrinted(true);//demoSheet
            HSSFFooter footer = demoSheet.getFooter();
            footer.setRight("Page " + HSSFFooter.page() + " of " + HSSFFooter.numPages());
            // 获得JSF上下文环境
            FacesContext context = FacesContext.getCurrentInstance();
            // 获得ServletContext对象
            ServletContext servletContext = (ServletContext) context.getExternalContext().getContext();
            // 取得文件的绝对路径
            String excelName = servletContext.getRealPath("/upload") + "/" + strfileName;//strfileName
            File exportFile = new File(excelName);
            fos = new FileOutputStream(exportFile);//fos
            demoWorkBook.write(fos);//demoWorkBook
            fos.close();

            FacesContext ctx = FacesContext.getCurrentInstance();
            ctx.responseComplete();
            HttpServletResponse httpServletResponse = (HttpServletResponse) ctx.getExternalContext().getResponse();
            ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
            httpServletResponse.setHeader("Content-disposition", "attachment; filename=" + strfileName);//strfileName
            httpServletResponse.setContentLength((int) exportFile.length());//exportFile
            httpServletResponse.setContentType("application/x-download");
            //httpServletResponse.setContentType("application/vnd.ms-excel");
            byte[] b = new byte[1024];
            int i = 0;
            FileInputStream fis = new java.io.FileInputStream(exportFile);
            while ((i = fis.read(b)) > 0) {
                servletOutputStream.write(b, 0, i);
            }
            servletOutputStream.flush();
            ctx.responseComplete();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public boolean isAddOrUpdate() {
        return addOrUpdate;
    }

    public void setAddOrUpdate(boolean addOrUpdate) {
        this.addOrUpdate = addOrUpdate;
    }

    public Expense getExp() {
        return exp;
    }

    public void setExp(Expense exp) {
        this.exp = exp;
    }

    public boolean isShowDisabled() {
        return showDisabled;
    }

    public void setShowDisabled(boolean showDisabled) {
        this.showDisabled = showDisabled;
    }

    public boolean isSubmitOrNot() {
        return submitOrNot;
    }

    public void setSubmitOrNot(boolean submitOrNot) {
        this.submitOrNot = submitOrNot;
    }

    public LinkedList<Expense> getProofList() {
        return proofList;
    }

    public void setProofList(LinkedList<Expense> proofList) {
        this.proofList = proofList;
    }

    public List<SelectItem> getFeeItems() {
        return feeItems;
    }

    public void setFeeItems(List<SelectItem> feeItems) {
        this.feeItems = feeItems;
    }

    public boolean isEditStatus() {
        return editStatus;
    }

    public void setEditStatus(boolean editStatus) {
        this.editStatus = editStatus;
    }

    public List<Expense> getBillList() {
        return billList;
    }

    public void setBillList(List<Expense> billList) {
        this.billList = billList;
    }

    public QueryVouchers getQlb() {
        return qlb;
    }

    public void setQlb(QueryVouchers qlb) {
        this.qlb = qlb;
    }

    public List<SelectItem> getPayStylelist() {
        return payStylelist;
    }

    public void setPayStylelist(List<SelectItem> payStylelist) {
        this.payStylelist = payStylelist;
    }

    public DataModel<Expense> getBillModel() {
        return billModel;
    }

    public void setBillModel(DataModel billModel) {
        this.billModel = billModel;
    }

    public String getPayWay() {
        return payWay;
    }

    public void setPayWay(String payWay) {
        this.payWay = payWay;
    }

    public UIDataTable getPersonData() {
        return personData;
    }

    public void setPersonData(UIDataTable personData) {
        this.personData = personData;
    }

    public boolean isUpdateAble() {
        return updateAble;
    }

    public void setUpdateAble(boolean updateAble) {
        this.updateAble = updateAble;
    }

    public int getVouIndex() {
        return vouIndex;
    }

    public void setVouIndex(int vouIndex) {
        this.vouIndex = vouIndex;
    }

    private String curPerNum() {
        return LoginParam.getPer().getCpsn_number();
    }

    private String curPerName() {
        return LoginParam.getPer().getCpsn_name();
    }

    private String curDeptCode() {
        return LoginParam.getDept().getCode();
    }

    private String curDeptName() {
        return LoginParam.getDept().getName();
    }

    private Date curLoginDate() {
        return LoginParam.getLoginDate();
    }

    private Integer curIyear() {
        return LoginParam.getIyear();
    }

    private String curOrgCode() {
        return LoginParam.getOrg().getCode();
    }

    public FinancialProject getFinProj() {
        return finProj;
    }

    public void setFinProj(FinancialProject finProj) {
        this.finProj = finProj;
    }

    public DataModel<FinancialProject> getFinProjModel() {
        return finProjModel;
    }

    public void setFinProjModel(DataModel<FinancialProject> finProjModel) {
        this.finProjModel = finProjModel;
    }

    public static FinancialProjectDao getFinProjdao() {
        return finProjdao;
    }

    public static void setFinProjdao(FinancialProjectDao finProjdao) {
        CostProofBean.finProjdao = finProjdao;
    }

    public String getProjParam() {
        return projParam;
    }

    public void setProjParam(String projParam) {
        this.projParam = projParam;
    }

    public List<SelectItem> getPerli() {
        return perli;
    }

    public void setPerli(List<SelectItem> perli) {
        this.perli = perli;
    }
}
